<?php
/**
 * Created by PhpStorm.
 * Author: D H
 * Date: 2017/6/16
 * Time: 14:14
 */

namespace app\android\controller;
use app\api\logic\Article as Articles;
use think\Request;
use tool\Common;

class Article extends Base {
    //根据新闻类型ID得到新闻列表
    public function getArticleListByTypeID(){
        return json((new Articles($this->request))->getArticleListByTypeID());
    }
    //根据新闻ID得到新闻详细信息
    public function getArticleMsgByArticleID(){
        return json((new Articles($this->request))->getArticleMsgByArticleID());
    }
    //得到全部新闻评论
    public function getComments(){
        return json((new Articles($this->request))->getComments());
    }

    //发表评论
    public function publishComments(){
        return json((new Articles($this->request))->publishComments());
    }

    //新闻点赞
    public function thumbUpArticle(){
        return json((new Articles($this->request))->thumbUpArticle());
    }

    //取消新闻点赞
    public function cancelArticle(){
        /*$data = json_decode(Request::instance()->getInput(),true);
        $object = new Articles();
        $package = $object->init($data)->cancelArticle();
        Common::json($package);*/
        return json((new Articles($this->request))->cancelArticle());
    }

    //根据新闻ID得到评论
    public function getCommentsByArticleID(){
        return json((new Articles($this->request))->getCommentsByArticleID());
    }

    //得到更多评论
    public function getMoreComments(){
        return json((new Articles($this->request))->getMoreComments());
    }

    //得到回复
    public function getReply(){
        return json((new Articles($this->request))->getReply());
    }

    //得到视频列表
    public function getVideoList(){
        return json((new Articles($this->request))->getVideoList());
    }

    //根据视频ID得到视频详情
    public function getVideoByVID(){
        return json((new Articles($this->request))->getVideoByVID());
    }

    //新闻点赞
    public function thumbUp(){
        return json((new Articles($this->request))->thumbUp());
    }
    //取消新闻评论点赞
    public function cancel(){
        return json((new Articles($this->request))->cancel());
    }

    //收藏新闻
    public function collectArticle(){
        return json((new Articles($this->request))->collectArticle());
    }

    //取消新闻收藏
    public function cancelCollect(){
        return json((new Articles($this->request))->cancelCollect());
    }

    //新闻与我相关
    public function relatedForMe()
    {
        return json((new Articles($this->request))->relatedForMe());
    }
}